<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="../../css/style.css" />
<script type="text/javascript" src="../js/httpRequest.js"></script>
<script type="text/javascript">
function hide(id){
	var parent=document.getElementById(id);
	if(parent.style.display!="block"){
		parent.style.display="block";
	}else{
		parent.style.display="none";
	}
}

function show(sub){
	alert(sub);
	sendRequest("../ajax/get_content.jsp", "subject="+encodeURIComponent(sub), resultContent, "POST");
}
function resultContent(){
	if(xhr.readyState==4 && xhr.status==200){
		var res=xhr.responseText;
		var cont=document.getElementById("study_content");
		cont.innerHTML=res;
	}
}

function hid(){
	var dv = document.getElementById("study_sidebar");
	if(dv.style.display=="none"){
		dv.style.display="block";
	}else if(dv.style.display=="block"){
		dv.style.display="none";
	}	
}

</script>
</head>
<body>
<div id="wrapper">
	<div id="study_page">
		<div id="study_content" style="border:2px solid white; background-color: white;">
			<div id="content_img">
				<img src="../img/green.jpg">
			</div>            			
		</div>
		<div id="show_btn">
			<input type="image" src="../img/btn_title.png" onclick="hid()">
		</div>
		<div id="study_sidebar"  style="display:none;">
			<div id="study_title" >
				<h2>
					Category
				</h2>
				<ul class="list">
<c:forEach var="s" items="${title_list }"  varStatus="i">
					<li class="first">
						<strong><a onclick="hide('h${i.index }')">${s.title_name }</a></strong>
						<div id="h${i.index }" style="display:none;">
							 	<c:forEach var="t" items="${study_list }">
								 	<c:if test="${t.title_no eq s.title_no }">
								 			&nbsp;&nbsp;&nbsp;<a onclick="show('${t.s_subject}')">${t.s_subject}</a><br>
								 	</c:if>	
							 	</c:forEach>
						</div>
					</li>
</c:forEach>	
				</ul>
				<a href="../study/study_writeForm.do?cate_no=${cate_no}&menu_no=${menu_no}">관리페이지</a>/
				<a href="#">내용수정</a>
			</div>
			
			
		</div><br class="clearfix" />
	</div>
</div>
</body>
</html>